﻿<Page x:Class="delitel.View.DivideResistor"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:delitel.ViewModel"
         xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
      mc:Ignorable="d" 
     
      Title="DivideResistor" FontSize="28" FontFamily="Times New Roman" >
    <Page.DataContext>
        <local:ResistorsViewModel/>
    </Page.DataContext>


    <Viewbox Stretch="Fill" >
      
            <Grid >

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
       
                <TabControl>
                <TabItem Name="shema" Header="схема">
                    <Image   Grid.Column="0" Source="/Image/Ris2-1024x865.jpg"  Margin="10,10,10,10"  Grid.Row="0" Panel.ZIndex="0" Stretch="Fill" />
                </TabItem>

                <TabItem  Header=" маркировка">
                    <Grid>
                    </Grid>
                </TabItem>
                    
                <TabItem  Header=" номинальные ряды">
                    <Grid>
                    </Grid>
                </TabItem>

                <TabItem Name="diagram" Header=" диаграмма">
                    <Grid>
                    </Grid>
                </TabItem>

                <TabItem Name="perexod" Header=" переходные процессы ">
                    <Grid>
                    </Grid>
                </TabItem>


            </TabControl>
            <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1">

                        <GroupBox Header="режим" BorderBrush="{x:Null}" >
                            <StackPanel>
                                <RadioButton  Content="постояный" IsChecked="{Binding FlagChangedConstMode, UpdateSourceTrigger=PropertyChanged}"/>
                                <RadioButton x:Name="Change_Pmode" Content="переменый" IsChecked="{Binding FlagChangedPMode, UpdateSourceTrigger=PropertyChanged}"/>

                                <WrapPanel>
                                    <TextBlock Text=" частота:"/>
                                    <TextBox Name="Chatota_txt"  PreviewTextInput="Chatota_txt_PreviewTextInput" Width="200"  IsEnabled="{Binding ElementName=Change_Pmode,Path=IsChecked}" Text="{Binding Chactota, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"/>
                                    <TextBlock Text="{Binding Str_Chastota, UpdateSourceTrigger=PropertyChanged}"/>
                                </WrapPanel>

                                <WrapPanel>
                                    <TextBlock Text=" фаза:"/>
                                    <TextBox Name="Phase_txt" PreviewTextInput="Phase_txt_PreviewTextInput" Width="200"  Margin="35,0,0,0" IsEnabled="{Binding ElementName=Change_Pmode,Path=IsChecked}"  Text="{Binding Phase, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" />
                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}" Width="30" FontSize="35"/>
                        </WrapPanel>

                        <GroupBox  BorderThickness="0" Header="знак фазы" IsEnabled="{Binding ElementName=Change_Pmode, Path=IsChecked}" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" BorderBrush="{x:Null}">
                            <StackPanel  Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <RadioButton Content="+ "  IsChecked="{Binding PhasePositiv, UpdateSourceTrigger=PropertyChanged}"/>
                                <RadioButton Content="-" IsChecked="{Binding PhaseNegativ, UpdateSourceTrigger=PropertyChanged}"/>
                            </StackPanel>
                        </GroupBox>
                    </StackPanel>
                        </GroupBox>

                        <GroupBox Header=" нагрузка">
                            <StackPanel>
                        <CheckBox x:Name="Load_Active"  IsEnabled="{Binding ElementName=shema, Path=IsSelected}" Content=" наличие" HorizontalAlignment="Center" IsChecked="{Binding FlagPower, UpdateSourceTrigger=PropertyChanged}"/>

                        <GroupBox BorderThickness="0" IsEnabled="{Binding ElementName=Load_Active, Path=IsChecked}"  BorderBrush="{x:Null}">
                            <StackPanel>
                                <RadioButton x:Name="Load_Resist" IsEnabled="{Binding ElementName=Load_Active, Path=IsChecked}" Content=" сопротивление " IsChecked="{Binding FlagPowerRessit, UpdateSourceTrigger=PropertyChanged}" />
                                <RadioButton x:Name="Load_Capist" Content="ёмкость" IsEnabled="{Binding ElementName=Load_Active,Path=IsChecked}" IsChecked="{Binding FlagPowerCapacity, UpdateSourceTrigger=PropertyChanged}"/>
                                <RadioButton x:Name="Load_induct" Content="индуктивность" IsEnabled="{Binding ElementName=Load_Active,Path=IsChecked}" IsChecked="{Binding FlagPowerInduction, UpdateSourceTrigger=PropertyChanged}"/>
                                <WrapPanel>
                                    <TextBox Name="ChPower_Load"    PreviewTextInput="ChPower_Load_PreviewTextInput"  Width="170" IsEnabled="{Binding ElementName=Load_Resist, Path=IsChecked}" Text="{Binding LoadResit, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"/>
                                    <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>

                                </WrapPanel>
                                <WrapPanel>
                                    <TextBox x:Name="TxCap"      Text="{Binding LoadCapac, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"  Width="170" IsEnabled="{Binding ElementName=Load_Capist, Path=IsChecked}" PreviewTextInput="TxCap_PreviewTextInput" />
                                    <TextBlock Text="{Binding Str_Capasiti , UpdateSourceTrigger=PropertyChanged}"/>

                                </WrapPanel>
                                <WrapPanel>
                                    <TextBox x:Name="TxInd"     Text="{Binding LoadInduc, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"   Width="170" IsEnabled="{Binding ElementName=Load_induct, Path=IsChecked}" PreviewTextInput="TxInd_PreviewTextInput_1" />
                                    <TextBlock Text="{Binding  Str_Induction, UpdateSourceTrigger=PropertyChanged}"/>
                                </WrapPanel>
                            </StackPanel>
                        </GroupBox>
                                
                        <GroupBox Header="порядок в цепи" BorderThickness="0">
                            <StackPanel  Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <RadioButton  Content="1" IsChecked="{Binding FlagPoradokOne, UpdateSourceTrigger=PropertyChanged}"/>
                                        <RadioButton  Content="2"  IsChecked="{Binding FlagPoradokTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                    </StackPanel>
                                </GroupBox>
                            </StackPanel>
                  
                </GroupBox>


                        <GroupBox Header=" приставки" >
                            <ScrollViewer CanContentScroll="True"  HorizontalScrollBarVisibility="Auto" Width="1730">
                        <StackPanel>

                            <WrapPanel ItemWidth=" 250" >

                                <GroupBox Header="ток" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Tok, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="напряжение" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Volta, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="сопротивление" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Resisters, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="активная мощность" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding ActivePower, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="частота" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Chactots, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Chastota, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="ёмкость" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Capacity, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Capasiti, UpdateSourceTrigger=PropertyChanged}"/>

                                </GroupBox>

                                <GroupBox Header="индуктивность" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding Induction, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_Induction, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="полная мощность" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding FullPowers, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>

                                <GroupBox Header="реакт. мощность" BorderThickness="0">
                                    <ComboBox ItemsSource="{Binding ReactPower, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" Text="{Binding  Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                </GroupBox>
                            </WrapPanel>

                        </StackPanel>

                    </ScrollViewer>
                        </GroupBox>
                    </StackPanel>

                    <GroupBox Grid.Column="0"   VerticalAlignment="Bottom" Grid.Row="2" Grid.ColumnSpan="2" >
                        <WrapPanel HorizontalAlignment="Left" >
                            <GroupBox Header="параметры как четерех полюсника">
                                <WrapPanel>


                            <GroupBox  IsEnabled="{Binding ElementName=shema, Path=IsSelected}"  Header="вид параметров" HorizontalAlignment="Right" Margin="100,0,0,0">
                                        <StackPanel >

                                            <RadioButton Content="Z" HorizontalAlignment="Center" IsChecked="{Binding ZParametr, UpdateSourceTrigger=PropertyChanged}" FontSize="40"/>
                                    <RadioButton Content="Y" HorizontalAlignment="Center" FontSize="40"  IsChecked="{Binding YParametr, UpdateSourceTrigger=PropertyChanged}"/>
                                    <RadioButton Content="A" HorizontalAlignment="Center" FontSize="40"  IsChecked="{Binding AParametr, UpdateSourceTrigger=PropertyChanged}"/>
                                    <RadioButton Content="B" HorizontalAlignment="Center" FontSize="40"  IsChecked="{Binding BParametr, UpdateSourceTrigger=PropertyChanged}"/>
                                    <RadioButton Content="H" HorizontalAlignment="Center" FontSize="40"  IsChecked="{Binding HParametr, UpdateSourceTrigger=PropertyChanged}"/>
                                    <RadioButton Content="G" HorizontalAlignment="Center" FontSize="40"  IsChecked="{Binding GParametr, UpdateSourceTrigger=PropertyChanged}"/>
                                    <Button Height="60" Command="{Binding CommandParametrs}" Content="получить" VerticalAlignment="Bottom" FontSize="35" />
                                        </StackPanel>

                                    </GroupBox>

                                    <StackPanel>

                                        <TextBlock FontSize="50" Text="{Binding OneOne, UpdateSourceTrigger=PropertyChanged}"/>
                                        <TextBlock FontSize="50" Text="{Binding OneTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                        <TextBlock FontSize="50" Text="{Binding TwoOne, UpdateSourceTrigger=PropertyChanged}"/>
                                        <TextBlock FontSize="50" Text="{Binding TwoTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                <TextBlock FontSize="50" Text="{Binding ResitIn, UpdateSourceTrigger=PropertyChanged}"/>
                                <TextBlock FontSize="50" Text="{Binding ResitOut, UpdateSourceTrigger=PropertyChanged}"/>
                                <TextBlock FontSize="50" Text="{Binding VoltageK, UpdateSourceTrigger=PropertyChanged}"/>
                                <TextBlock FontSize="50" Text="{Binding AmperK, UpdateSourceTrigger=PropertyChanged}"/>
                                <TextBlock FontSize="50" Text="{Binding VoltageKDelitel, UpdateSourceTrigger=PropertyChanged}"/>
                                        

                            </StackPanel>
                            <TextBlock FontSize="50" Text="{Binding ComentK, UpdateSourceTrigger=PropertyChanged}"/>

                            <GroupBox Header="переходные характеристики" HorizontalAlignment="Right">
                                        <WrapPanel>
                                            <StackPanel >
                                                <WrapPanel HorizontalAlignment="Center">
                                                    <GroupBox Header="воздействие " Margin="60,0,0,0">
                                                        <StackPanel>

                                                            <RadioButton Content="U1(t)" IsChecked="True" FontSize="40"/>
                                                            <RadioButton Content="U2(t)" FontSize="40"/>
                                                            <RadioButton Content="I1(t)" FontSize="40"/>
                                                            <RadioButton  Content="I2(t)" FontSize="40"/>

                                                        </StackPanel>
                                                    </GroupBox>

                                                    <GroupBox Header="рекция ">
                                                        <StackPanel >

                                                            <RadioButton Content="U1(t)" FontSize="40"/>
                                                            <RadioButton Content="U2(t)"  IsChecked="True" FontSize="40"/>
                                                            <RadioButton Content="I1(t)" FontSize="40"/>
                                                            <RadioButton  Content="I2(t)" FontSize="40"/>

                                                        </StackPanel>
                                                    </GroupBox>

                                                </WrapPanel>
                                                <Button Height="60" Content="расчет  характеристик" FontSize="35" IsEnabled="{Binding ElementName=perexod, Path=IsSelected}"/>
                                        <Button Height="60" Content="график переходной характеристики" FontSize="35"  IsEnabled="{Binding ElementName=perexod, Path=IsSelected}"/>
                                        <Button Height="60" Content="график импульсной характеристики" FontSize="35"  IsEnabled="{Binding ElementName=perexod, Path=IsSelected}"/>
                                            </StackPanel>

                                           

                                        </WrapPanel>
                                    </GroupBox>

                                </WrapPanel>
                            </GroupBox>

                            <GroupBox Header="параметры цепи"  Width="1580" Margin="10,0,0,0">
                                <StackPanel>

                                    <TextBlock Text="{Binding Result, UpdateSourceTrigger=PropertyChanged}" FontSize="45" Width="1560" TextWrapping="Wrap"/>

                                    <GroupBox Header="примечание" BorderBrush="Red">
                                        <TextBlock Text="{Binding Coment,UpdateSourceTrigger=PropertyChanged}" FontSize="45" TextWrapping="Wrap"/>
                                    </GroupBox>

                                </StackPanel>
                            </GroupBox>
                        </WrapPanel>

                    </GroupBox>

                    <Grid Grid.Column="1"  HorizontalAlignment="Left">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <StackPanel Grid.Column="0" Orientation="Horizontal">
                            <ScrollViewer>
                                <GroupBox Header=" входные параметры" Margin="10,0,5,0" BorderBrush="{x:Null}" >
                                    <StackPanel>

                                        <GroupBox Header=" расчет  параметров" HorizontalAlignment="Center" BorderBrush="Black">
                                            <StackPanel Orientation="Horizontal"  Margin="10,0,10,0">

                                                <StackPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="Uвх:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="U" Width="200"  Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Margin="0,0,0,0" PreviewTextInput="U_PreviewTextInput" />
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="R1:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="R1" Width="200" Text="{Binding ResistorOne, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Margin="15,0,0,0" PreviewTextInput="R1_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="R2:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="R2" Width="200" Text="{Binding ResistorTwo, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"  Margin="15,0,0,0" PreviewTextInput="R2_PreviewTextInput" />
                                                        <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <Button Content="расчет" Command="{Binding FirstVariantExecution, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=shema, Path=IsSelected}" />
                                                    <Button  Content="векторная диаграмма" IsEnabled="{Binding ElementName=diagram, Path=IsSelected}"/>
                                                </StackPanel>

                                                <GroupBox Header="результат"   Margin="10,0,0,0" BorderBrush="Blue">

                                                    <StackPanel HorizontalAlignment="Center">
                                                        <WrapPanel >
                                                            <TextBlock Text="Uвых1= " />
                                                            <TextBox Width="200" Text="{Binding Voltage_ExiteOne, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True" />
                                                            <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Uвых2= " />
                                                            <TextBox Width="200" Text="{Binding Voltage_ExiteTwo, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="I цепи=" />
                                                            <TextBox Width="200" Text="{Binding Amperage, UpdateSourceTrigger=PropertyChanged}"  Margin="13.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr1=" />
                                                            <TextBox Width="200" Text="{Binding PowerActiveOne, UpdateSourceTrigger=PropertyChanged}" Margin="48.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr2=" />
                                                            <TextBox Width="200"   Text="{Binding PowerActiveTwo, UpdateSourceTrigger=PropertyChanged}" Margin="48.5,0,0,0" IsReadOnly="True"/>
                                                    <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pн=" />
                                                            <TextBox Width="200"  Text="{Binding PowerLoad, UpdateSourceTrigger=PropertyChanged}" Margin="57,0,0,0" IsReadOnly="True"/>
                                                          <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pр=" />
                                                            <TextBox Width="200"   Margin="58 ,0,0,0" IsReadOnly="True" Text="{Binding PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                                            <TextBlock Text="{Binding Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pпол=" />
                                                            <TextBox Width="200"  Text="{Binding PowerFull, UpdateSourceTrigger=PropertyChanged}" Margin="29,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="φвых=" />
                                                            <TextBox Width="200" Text="{Binding Phaseresultl, UpdateSourceTrigger=PropertyChanged}" Margin="25,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                    </StackPanel>
                                                </GroupBox>
                                            </StackPanel>
                                        </GroupBox>

                                        <GroupBox Header="расчет резисторов" HorizontalAlignment="Center" BorderBrush="Black">
                                            <StackPanel Orientation="Horizontal" Margin="10,0,10,0">
                                                <StackPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="Uвх:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="_2s_U" Width="200"   Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Margin="19,0,0,0" PreviewTextInput="_2s_U_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="Uвых:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="Uexite" Width="200" PreviewTextInput="Uexite_PreviewTextInput" />
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}" />
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="Rобщ:" FontFamily="Times New Roman" FontSize="27"/>
                                                        <TextBox x:Name="Rf" Width="200" PreviewTextInput="Rf_PreviewTextInput" />
                                                        <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>

                                                    </WrapPanel>
                                                    <GroupBox Header="номер выхода">
                                                        <WrapPanel HorizontalAlignment="Center">
                                                            <RadioButton Content="1"/>
                                                            <RadioButton Content="2"  IsChecked="True"/>
                                                        </WrapPanel>
                                                    </GroupBox>
                                            <Button Command="{Binding ComTwoVariantExecution, UpdateSourceTrigger=PropertyChanged}" Content="расчет"   IsEnabled="{Binding ElementName=shema, Path=IsSelected}"/>
                                            <Button  Content="кторная диаграмма" IsEnabled="{Binding ElementName=diagram, Path=IsSelected}"/>
                                                </StackPanel>

                                                <GroupBox Header="результат"  Margin="10,0,0,0" BorderBrush="Blue">

                                                    <StackPanel HorizontalAlignment="Center">
                                                        <WrapPanel >
                                                            <TextBlock Text="R1= "  />
                                                            <TextBox Width="200" Margin="34,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="R2= " />
                                                            <TextBox Width="200" Margin="34,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="I цепи=" />
                                                            <TextBox Width="200" IsReadOnly="True" />
                                                            <TextBlock Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr1=" />
                                                            <TextBox Width="200"  Margin="34.7,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr2=" />
                                                            <TextBox Width="200"  Margin="35,0,0,0" IsReadOnly="True" />


                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel >

                                                        <WrapPanel>
                                                            <TextBlock Text="Pн=" />
                                                            <TextBox Width="200"  Margin="43,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pр=" />
                                                            <TextBox Width="200"   Margin="45,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pпол= " />
                                                            <TextBox Width="200"  Margin="8.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="φвых=" />
                                                            <TextBox Width="200"  Margin="11.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                    </StackPanel>

                                                </GroupBox>

                                            </StackPanel>
                                        </GroupBox>

                                        <GroupBox Header="расчет резистора 1" BorderBrush="Black">
                                            <StackPanel Orientation="Horizontal" Margin="10,0,10,0">
                                                <StackPanel>
                                                    <WrapPanel>
                                                        <TextBlock Text="Uвх:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="_3_U" Width="200"   Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Margin="6,0,0,0" PreviewTextInput="_3_U_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="U2:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="U_2" Width="200" Margin="19,0,0,0" PreviewTextInput="U_2_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="R2:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="R_2" Text="{Binding ResistorTwo, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Width="200" Margin="21,0,0,0" PreviewTextInput="R_2_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                            <Button Command="{Binding ComThereVariantExecution, UpdateSourceTrigger=PropertyChanged}" Content="расчет"  IsEnabled="{Binding ElementName=shema, Path=IsSelected}" />
                                            <Button  Content="векторная диаграмма" IsEnabled="{Binding ElementName=diagram, Path=IsSelected}"/>
                                                </StackPanel>

                                                <GroupBox Header="результат"  Margin="10,0,0,0" BorderBrush="Blue">

                                                    <StackPanel HorizontalAlignment="Center">
                                                        <WrapPanel >
                                                            <TextBlock Text="R1= "  />
                                                            <TextBox Width="200" Margin="34,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="I цепи=" />
                                                            <TextBox Width="200" IsReadOnly="True" />
                                                            <TextBlock Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr1=" />
                                                            <TextBox Width="200"  Margin="35,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr2=" />
                                                            <TextBox Width="200"  Margin="35,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pн=" />
                                                            <TextBox Width="200"  Margin="43,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pр=" />
                                                            <TextBox Width="200"   Margin="44,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pпол=" />
                                                            <TextBox Width="200"  Margin="16,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="φвых=" />
                                                            <TextBox Width="200"  Margin="11.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                    </StackPanel>

                                                </GroupBox>

                                            </StackPanel>
                                        </GroupBox>

                                        <GroupBox Header="расчет резистора 2"  BorderBrush="Black">
                                            <StackPanel Orientation="Horizontal" Margin="10,0,10,0">
                                                <StackPanel>
                                                    <WrapPanel>
                                                        <TextBlock Text="Uвх:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="_4_U" Width="200"   Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" Margin="6,0,0,0" PreviewTextInput="_4_U_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="U1:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="U_1" Width="200"  Margin="19,0,0,0" PreviewTextInput="U_1_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                                    <WrapPanel>
                                                        <TextBlock Text="R1:" FontFamily="Times New Roman" FontSize="28"/>
                                                        <TextBox x:Name="R_1" Text="{Binding ResistorOne, UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}"  Width="200" Margin="21,0,0,0" PreviewTextInput="R_1_PreviewTextInput"/>
                                                        <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                    </WrapPanel>

                                            <Button Command="{Binding ComForVariantExecution, UpdateSourceTrigger=PropertyChanged}" Content="расчет" IsEnabled="{Binding ElementName=shema, Path=IsSelected}" />
                                            <Button  Content="векторная диаграмма" IsEnabled="{Binding ElementName=diagram, Path=IsSelected}"/>
                                                </StackPanel>

                                                <GroupBox Header="результат"  Margin="10,0,0,0" BorderBrush="Blue">

                                                    <StackPanel HorizontalAlignment="Center">
                                                        <WrapPanel >
                                                            <TextBlock Text="R2= "  />
                                                            <TextBox Width="200" Margin="34.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="I цепи=" />
                                                            <TextBox Width="200"  IsReadOnly="True" />
                                                            <TextBlock Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr1=" />
                                                            <TextBox Width="200"  Margin="35,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pr2=" />
                                                            <TextBox Width="200"  Margin="35,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pн=" />
                                                            <TextBox Width="200"  Margin="43.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pр=" />
                                                            <TextBox Width="200"   Margin="44,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="Pобщ=" />
                                                            <TextBox Width="200"  Margin="8.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                        <WrapPanel>
                                                            <TextBlock Text="φвых=" />
                                                            <TextBox Width="200"  Margin="11.5,0,0,0" IsReadOnly="True"/>
                                                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}"/>
                                                        </WrapPanel>

                                                    </StackPanel>

                                                </GroupBox>

                                            </StackPanel>
                                        </GroupBox>

                                    </StackPanel>
                                </GroupBox>
                            </ScrollViewer>

                        </StackPanel>

                    </Grid>

                    <GroupBox Grid.Row="1" Grid.Column="1" Header=" погрешности" Margin="10,0,10,0" Height="310">
                        <WrapPanel>
                            <ScrollViewer>
                                <WrapPanel>
                                    <StackPanel >
                                        <WrapPanel>
                                            <TextBlock Text="R1:"/>
                                            <TextBox Width="200" IsReadOnly="True" Margin="47,0,0,0" Text="{Binding NegativResistOne, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding PositivResistOne, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="R2:"/>
                                            <TextBox Width="200" IsReadOnly="True"  Margin="47,0,0,0" Text="{Binding NegativResistTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivResistTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Rн:"/>
                                            <TextBox Width="200" IsReadOnly="True"  Margin="46,0,0,0" Text="{Binding NegativResistenLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding  PositivResistenLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>
                                        
                                <WrapPanel>
                                    <TextBlock Text="Zc:" />
                                    <TextBox Width="200"  IsReadOnly="True" Margin="50,0,0,0" Text="{Binding NegativCapacit, UpdateSourceTrigger=PropertyChanged}"/>
                                    <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivCapacit, UpdateSourceTrigger=PropertyChanged}" />
                                    <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                </WrapPanel>

                                <WrapPanel>
                                    <TextBlock Text="ZL:" />
                                    <TextBox Width="200"  IsReadOnly="True" Margin="46,0,0,0" Text="{Binding NegativInduction, UpdateSourceTrigger=PropertyChanged}"/>
                                    <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivInduction, UpdateSourceTrigger=PropertyChanged}" />
                                    <TextBlock Text="{Binding Str_Resister, UpdateSourceTrigger=PropertyChanged}"/>
                                </WrapPanel>
                                        

                                <WrapPanel>
                                            <TextBlock Text="I:" />
                                            <TextBox Width="200" IsReadOnly="True" Margin="70,0,0,0" Text="{Binding NegativAmperage, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding PositivAmperage, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Amperage, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Uвых1:"/>
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding NegativVoltage_ExiteOne, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding PositivVoltage_ExiteOne, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Uвых2:" />
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding NegativVoltage_ExiteTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivVoltage_ExiteTwo, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Pr1:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="41,0,0,0" Text="{Binding NegativPowerActiveOne, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivPowerActiveOne, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Pr2:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="41,0,0,0" Text="{Binding NegativPowerActiveTwo, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivPowerActiveTwo, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBlock Text="{Binding Str_PowerActive, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>


                                        <WrapPanel>
                                            <TextBlock Text="Pн:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="50,0,0,0" Text="{Binding NegativPowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True"  Text="{Binding PositivPowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_PowerLoad, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Pр:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="50,0,0,0" Text="{Binding NegativPowerReactive, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBox Width="200" IsReadOnly="True"  Text="{Binding PositivPowerReactive, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBlock Text="{Binding Str_PowerReactive, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="Pпол:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="22,0,0,0" Text="{Binding NegativPowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True" Text="{Binding PositivPowerFull, UpdateSourceTrigger=PropertyChanged}" />
                                            <TextBlock Text="{Binding Str_PowerFull, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <WrapPanel>
                                            <TextBlock Text="φвых:" />
                                            <TextBox Width="200"  IsReadOnly="True" Margin="18,0,0,0" Text="{Binding NegativPhase, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200" IsReadOnly="True"  Text="{Binding PositivPhase, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Phase, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel>

                                        <!--WrapPanel>
                                            <TextBlock Text="Uвх:"/>
                                            <TextBox Width="200"  IsReadOnly="True" Margin="33,0,0,0" Text="{Binding NegativVoltage, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBox Width="200"  IsReadOnly="True" Text="{Binding PositivVoltage, UpdateSourceTrigger=PropertyChanged}"/>
                                            <TextBlock Text="{Binding Str_Voltage, UpdateSourceTrigger=PropertyChanged}"/>
                                        </WrapPanel -->
                                                
                                    </StackPanel>
                                </WrapPanel>
                            </ScrollViewer>
                            <GroupBox BorderThickness="0" Header="% погрешностей" VerticalAlignment="Center">
                                <StackPanel  HorizontalAlignment="Center">
                                    <WrapPanel>
                                        <TextBlock Text="R1:"/>
                                        <TextBox x:Name="pogresh"   Width="200" Text="{Binding Pogresh1,UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" PreviewTextInput="pogresh_PreviewTextInput" />
                                    </WrapPanel>
                                    <WrapPanel>
                                        <TextBlock Text="R2:"/>
                                        <TextBox x:Name="pp" Width="200" Text="{Binding Pogresh2,UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" PreviewTextInput="pp_PreviewTextInput"/>
                                    </WrapPanel>
                                    <WrapPanel>
                                        <TextBlock Text="Za:" Margin="3,0,0,0"/>
                                        <TextBox x:Name="ppr" Width="200" Text="{Binding Pogresh3,UpdateSourceTrigger=PropertyChanged, StringFormat=0.00}" PreviewTextInput="ppr_PreviewTextInput"/>
                                    </WrapPanel>
                            <Button Content="почитать погрешность" Command="{Binding PogreshComand, UpdateSourceTrigger=PropertyChanged}"  IsEnabled="{Binding ElementName=shema, Path=IsSelected}"/>
                                </StackPanel>
                            </GroupBox>
                        </WrapPanel>
                    </GroupBox>
 
        </Grid>
     
    </Viewbox>
</Page>
